<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>

<link rel="stylesheet" type="text/css" href="<c:url value="/resources/css/header.css"/>" />

<header>

<div class="project">
	  <a href="<c:url value="/subscriber/home"/>" class="navbar-brand"> Telephone Exchange </a>
	</div>

  <form:form commandName="activeMenu">
  
	<ul class="nav nav-pills pull-right">
	
	
      <li> 
        <a href="profile">${username}</a>
      </li>
      
      <li class="dropdown">
        <a href="#" class="dropdown-toggle" data-toggle="dropdown">${mainAccount.telephoneNumber.countryCode}-${mainAccount.telephoneNumber.operatorCode}-${mainAccount.telephoneNumber.number}<b class="caret"></b></a>
        <ul class="dropdown-menu">
          <c:forEach var="account" items="${accounts}">
              <li><a href="accounts/${account.id}">+${account.telephoneNumber.countryCode}-${account.telephoneNumber.operatorCode}-${account.telephoneNumber.number}</a></li>
          </c:forEach>
          <li class="divider"></li>
          <li><a href="<c:url value="/subscriber/createAccount"/>">Create new account</a></li>
        </ul>
      </li>

	  <c:if test="${activeMenu == 'balance'}">
		  <li class="active">
		  	<a href="account/balance">
		  	  Balance
		  	  <span class="badge">${mainAccount.balance}</span>
		  	</a>
		  </li>
	   </c:if>
	   <c:if test="${activeMenu != 'balance'}">
		  <li>
		  	<a href="account/balance">
		  	  Balance
		  	  <span class="badge">${mainAccount.balance}</span>
		  	</a>
		  </li>
	   </c:if>

      <li> 
        <a href="<c:url value="/j_spring_security_logout" />">Logout</a> 
      </li>
      
      
    </ul>
    
  </form:form>
    
</header>